<?

echo "MODIFY MODE :" 	.$_SESSION["modify_mode"]. "<br/>\n";

if($_SESSION["modify_mode"] == "Y"){

	$status_of_write="Modify";
}else{

	$status_of_write="Confirm";
}

require("entry_header_html.php");		
//query and get the table header

$CHtml = new CGHtml;

$tmpRecvQty = 0;

echo  "<table label='entryDetail' border='1' class='dedeq'>\n".
      "<th> NO      </th>\n".
      "<th> Odr-Date</th>\n".
      "<th> Odr-REF </th>\n".
      "<th> Odr-NO  </th>\n".
      "<th> Cat     </th>\n".
      "<th> Grp     </th>\n".
      "<th> Model   </th>\n".
      /*    ModelId * Hidden */ 
      "<th> Unit    </th>\n".
      "<th> Qty     </th>\n".
      "<th> Cvt     </th>\n".
      "<th> Qty     </th>\n".
      "<th> Received</th>\n".
      "<th> Price   </th>\n".
      "<th> #       </th>\n";

for($iRow = 0; $iRow < $_SESSION["init_num"]; $iRow++){      
  
  echo  "<tr>\n".
            
          "<td> ".($iRow + 1)." </td>\n".
  
          "<td> ".$CHtml->formInput("odrDateEnt[".$iRow."]",
                                    $_POST["odrDateEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
          
          "<td> ".$CHtml->formInput("odrRefEnt[".$iRow."]",
                                    $_POST["odrRefEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
          
          "<td> ".$CHtml->formInput("odrNoEnt[".$iRow."]",
                                    $_POST["odrNoEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
          
          "<td> ".$CHtml->formInput("catEnt[".$iRow."]",
                                    $_POST["catEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          "<td> ".$CHtml->formInput("grpEnt[".$iRow."]",
                                    $_POST["grpEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                                                                                                  
          "<td> ".$CHtml->formInput("modelEnt[".$iRow."]",
                                    $_POST["modelEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          $CHtml->formHidden("modelIdEnt[".$iRow."]",
                             $_POST["modelIdEnt"][$iRow],
                             _MODE_READONLY).
                                    
          "<td> ".$CHtml->formInput("unitEnt[".$iRow."]",
                                    $_POST["unitEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          "<td> ".$CHtml->formInput("qtyEnt[".$iRow."]",
                                    $_POST["qtyEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          "<td> ".$CHtml->formInput("cvtEnt[".$iRow."]",
                                    $_POST["cvtEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          "<td> ".$CHtml->formInput("cvtQtyEnt[".$iRow."]",
                                    $_POST["cvtQtyEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          "<td>   <table class='dedeq'>
                  <tr>
                  
                    <td> ".$CHtml->formInput("lstCvtEnt[".$iRow."]",
                                             $_POST["lstCvtEnt"][$iRow],
                                             $numStyleSz5.
                                             _MODE_READONLY)." </td>
              
                    <td> ".$CHtml->formInput("recvQtyEnt[".$iRow."]",
                                             $_POST["recvQtyEnt"][$iRow],
                                             $numStyleSz5.
                                             _MODE_READONLY)." </td> 
                  </tr>
                  </table>
                </td>\n".
                                    
          "<td> ".$CHtml->formInput("priceEnt[".$iRow."]",
                                    $_POST["priceEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
                                    
          "<td> ".$CHtml->formInput("hrzTotEnt[".$iRow."]",
                                    $_POST["hrzTotEnt"][$iRow],
                                    $numStyleSz5.
                                    _MODE_READONLY)." </td>\n".
        "</tr>\n";
  
  $tmpRecvQty += (int)$_POST["recvQtyEnt"][$iRow];
}

/**
* Print the total
*
*/
$_POST["totRecvQtyEnt"] = $tmpRecvQty;

echo  "<tr>\n".
        
        "<td colspan='11' align='right'><b> TOTAL </b></td>\n".
        
        "<td> ".$CHtml->formInput("totRecvQtyEnt",
                                  $_POST["totRecvQtyEnt"],
                                  $fullSpaceWNumStyle.
                                  _MODE_READONLY)." </td>\n".
        
        "<td colspan='2'> </td>\n".
        
      "</tr>\n";
      
echo  "</table>\n".
      "<br/>\n";

echo 	$CHtml->formInputButton("Save",
                              "confirm",
                              "Confirm",
                              $stlButton).
			
			$CHtml->formInputButton("Back",
                              "back",
                              "Back",
                              $stlButton).
  		
  		"</form>	\n";

?>